<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 7.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha256-wiz7ZSCn/btzhjKDQBms9Hx4sSeUYsDrTLg7roPstac=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.css" integrity="sha256-6cQIC71/iBIYXFK+0RHAvwmjwWzkWd+r7v/BX3/vZDc=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/green/pace-theme-minimal.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous"></script>

<script class="next-config" data-name="main" type="application/json">{"hostname":"sumumm.github.io","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.19.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":"mac"},"fold":{"enable":true,"height":300},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":true,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="本文主要是图片格式——JPEG压缩标准中Exif文件格式标准的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:type" content="article">
<meta property="og:title" content="LV01-图像-03-图片格式-03-04-JPEG中的Exif文件格式标准">
<meta property="og:url" content="https://sumumm.github.io/post/ca37adf1.html">
<meta property="og:site_name" content="苏木">
<meta property="og:description" content="本文主要是图片格式——JPEG压缩标准中Exif文件格式标准的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/image-20241012070650615.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/image-20241012192911174.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/image-20241012200228532.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/image-20241012200228532.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/image-20241012201052704.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/3a2859ea374bf7386a2f2c019b4701f5.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/92aa276e25a6f7c1f193da515bdf5a76.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/image-20241012215710503.png">
<meta property="article:published_time" content="2024-10-12T14:57:35.000Z">
<meta property="article:modified_time" content="2025-06-13T16:25:57.063Z">
<meta property="article:author" content="苏木">
<meta property="article:tag" content="(ALPHA)LV01-图像基础知识">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/image-20241012070650615.png">


<link rel="canonical" href="https://sumumm.github.io/post/ca37adf1.html">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":"","permalink":"https://sumumm.github.io/post/ca37adf1.html","path":"post/ca37adf1.html","title":"LV01-图像-03-图片格式-03-04-JPEG中的Exif文件格式标准"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>LV01-图像-03-图片格式-03-04-JPEG中的Exif文件格式标准 | 苏木</title>
  








    <script src="/js/browser_tools_disable.js"></script>

  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<!-- hexo injector head_end start --><link rel="stylesheet" href="https://unpkg.com/hexo-next-tags-plus@latest/lib/tag_plus.css" media="defer" onload="this.media='all'"><!-- hexo injector head_end end --></head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">苏木</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">我的学习之路</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>苏木的家</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类页<span class="badge">42</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档页<span class="badge">673</span></a></li><li class="menu-item menu-item-flink"><a href="/flink/" rel="section"><i class="fa fa-link fa-fw"></i>友人帐</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于我</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81Exif%E7%AE%80%E4%BB%8B"><span class="nav-text">一、Exif简介</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E5%9B%BE%E7%89%87%E5%85%83%E6%95%B0%E6%8D%AE%EF%BC%88Metadata%EF%BC%89"><span class="nav-text">1. 图片元数据（Metadata）</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-Exif%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F"><span class="nav-text">2. Exif是什么？</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-EXIF%E4%B8%8EJPEG%E7%9A%84%E5%85%B3%E7%B3%BB"><span class="nav-text">3. EXIF与JPEG的关系</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-JPEG%E4%B8%A4%E7%A7%8D%E6%96%87%E4%BB%B6%E7%BB%93%E6%9E%84%E7%9A%84%E5%9F%BA%E6%9C%AC%E6%A0%B7%E5%BC%8F"><span class="nav-text">4. JPEG两种文件结构的基本样式</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E8%AF%B4%E6%98%8E"><span class="nav-text">二、Exif文件格式说明</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-JPEG-format-and-Marker"><span class="nav-text">1. JPEG format and Marker</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-Exif-data-structure"><span class="nav-text">2. Exif data structure</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-APP1%E6%A0%87%E8%AE%B0"><span class="nav-text">2.1 APP1标记</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-APP1%E6%AE%B5%E9%95%BF%E5%BA%A6"><span class="nav-text">2.2 APP1段长度</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-3-%E6%A0%87%E8%AF%86%E7%AC%A6"><span class="nav-text">2.3 标识符</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-4-TIFF-Header"><span class="nav-text">2.4 TIFF Header</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-5-IFD%E2%80%94%E2%80%94Image-File-Directory"><span class="nav-text">2.5 IFD——Image File Directory</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#2-5-1-%E6%A0%BC%E5%BC%8F%E8%AF%B4%E6%98%8E"><span class="nav-text">2.5.1 格式说明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-5-2-data-format"><span class="nav-text">2.5.2 data format</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-5-3-Tag-number"><span class="nav-text">2.5.3 Tag number</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#2-5-3-1-IFD0%E4%B8%AD%E5%B8%B8%E8%A7%81%E7%9A%84Tags"><span class="nav-text">2.5.3.1 IFD0中常见的Tags</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#2-5-3-2-Exif-SubIFD%E4%B8%AD%E5%B8%B8%E8%A7%81%E7%9A%84Tags"><span class="nav-text">2.5.3.2  Exif SubIFD中常见的Tags</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#2-5-3-3-IFD1%E4%B8%AD%E5%B8%B8%E8%A7%81%E7%9A%84tags"><span class="nav-text">2.5.3.3 IFD1中常见的tags</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#2-5-3-4-Misc-Tags"><span class="nav-text">2.5.3.4 Misc Tags</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-5-4-%E4%B8%80%E4%B8%AA%E7%AE%80%E5%8D%95%E7%9A%84%E5%AE%9E%E4%BE%8B"><span class="nav-text">2.5.4 一个简单的实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-6-Thumbnail-image"><span class="nav-text">2.6 Thumbnail image</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#2-6-1-JPEG%E6%A0%BC%E5%BC%8F%E7%9A%84%E7%BC%A9%E7%95%A5%E5%9B%BE"><span class="nav-text">2.6.1 JPEG格式的缩略图</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-6-2-TIFF%E6%A0%BC%E5%BC%8F%E7%BC%A9%E7%95%A5%E5%9B%BE"><span class="nav-text">2.6.2 TIFF格式缩略图</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E4%B8%80%E4%B8%AA%E5%B0%8F%E5%B7%A5%E5%85%B7"><span class="nav-text">3. 一个小工具</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="苏木"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">苏木</p>
  <div class="site-description" itemprop="description">莫道桑榆晚，为霞尚满天</div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">673</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">42</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">43</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <a href="https://github.com/sumumm" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;sumumm" rel="noopener me" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://sumumm.github.io/post/ca37adf1.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="苏木">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="苏木">
      <meta itemprop="description" content="莫道桑榆晚，为霞尚满天">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="LV01-图像-03-图片格式-03-04-JPEG中的Exif文件格式标准 | 苏木">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          LV01-图像-03-图片格式-03-04-JPEG中的Exif文件格式标准
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2024-10-12 22:57:35" itemprop="dateCreated datePublished" datetime="2024-10-12T22:57:35+08:00">2024-10-12</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/" itemprop="url" rel="index"><span itemprop="name">嵌入式开发</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/" itemprop="url" rel="index"><span itemprop="name">04音视频</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/" itemprop="url" rel="index"><span itemprop="name">LV01-图像基础知识</span></a>
        </span>
    </span>

  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>11k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>40 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><p>本文主要是图片格式——JPEG压缩标准中Exif文件格式标准的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。</p>
<span id="more"></span>

<!-- Photo: https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/ -->

<details class="folding-tag" blue><summary> 点击查看使用工具及版本 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center" rowspan="5">PC端开发环境</td>        <td align="center" width=150px>Windows</td>        <td align="left">Windows11</td>    </tr>    <tr>        <td align="center">Ubuntu</td>        <td align="left">Ubuntu20.04.6的64位版本</td>      </tr>    <tr>        <td align="center">VMware® Workstation 17 Pro</td>        <td align="left">17.0.0 build-20800274</td>      </tr>    <tr>        <td align="center">终端软件</td>        <td align="left">MobaXterm(Professional Edition v23.0 Build 5042 (license))</td>    </tr>    <tr>        <td align="center">Win32DiskImager</td>        <td align="left">Win32DiskImager v1.0</td>      </tr>    <tr>        <td align="center" rowspan="3">Linux开发板环境</td>        <td align="center">Linux开发板</td>        <td align="left">正点原子 i.MX6ULL Linux 阿尔法开发板</td>      </tr>    <tr>        <td align="center">uboot</td>        <td align="left">NXP官方提供的uboot，NXP提供的版本为uboot-imx-rel_imx_4.1.15_2.1.0_ga(使用的uboot版本为U-Boot 2016.03)</td>      </tr>    <tr>        <td align="center">linux内核</td>        <td align="left">linux-4.15(NXP官方提供)</td>      </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看本文参考资料 </summary>
              <div class='content'>
              <ul><li>通用</li></ul><table>    <tr><td align="center">参考资料  </td><td align="center">相关链接</td></tr>    <tr><td align="left">JPEG官网？</td><td align="left"><a href="https://jpeg.org/jpeg/index.html" target="_blank">jpeg.org<i class="fa fa-external-link-alt"></i> </a></td></tr>    <tr><td align="left" rowspan="2">JPEG文件格式参考文档</td><td align="left"><a href="https://www.ijg.org/files/T-REC-T.871-201105-I!!PDF-E.pdf" target="_blank">JPEG File Interchange Format (JFIF) ---在线文档<i class="fa fa-external-link-alt"></i> </a></td></tr>    <tr><td align="left"><a href="./参考资料/T-REC-T.871-201105-I!!PDF-E.pdf" target="_blank">JPEG File Interchange Format (JFIF) ---本地文档<i class="fa fa-external-link-alt"></i> </a></td></tr>    <tr><td align="left" rowspan="1">JPEG中的Exif文件格式标准</td><td align="left"><a href="https://www.media.mit.edu/pia/Research/deepview/exif.html" target="_blank">Exif file format (mit.edu)<i class="fa fa-external-link-alt"></i> </a></td></tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看相关文件下载 </summary>
              <div class='content'>
              <table>    <tr><td align="left"><a href="https://pan.baidu.com/s/1wzzSNP5jth2hLdP5TMQWvA?pwd=u0ig" target="_blank">LV01-图像-03-图片格式-03-04-JPEG中的Exif文件格式标准</a></td><td align="left">链接：https://pan.baidu.com/s/1wzzSNP5jth2hLdP5TMQWvA?pwd=u0ig 提取码：u0ig </td></tr></table>
              </div>
            </details>

<p>其实使用工具来分析JPEG图片就可以了，但是之前做项目的时候遇到了一种Exif结构的JPEG图片，内部包含的信息比JFIF的要多，要复杂，还包含了一张缩略图，缩略图的分辨率信息也是从FF C0开始的，由于获取图片分辨率的时候是直接查找FF C0，所以就获取到了错误分辨率，这里写个笔记，简单解析一下Exif格式图片中的一些额外的信息。</p>
<h1 id="一、Exif简介"><a href="#一、Exif简介" class="headerlink" title="一、Exif简介"></a><font size=3>一、Exif简介</font></h1><p>上一节的时候已经简单说明过：JPEG标准主要是围绕编解码的部分（如DCT变换、量化、哈夫曼树等等），虽然在JPEG标准中也定义了“<strong>JPEG Interchange Format (JIF)<strong>”的文件存储格式，但是因为Encoder和Decoder完整实现JIF很困难，且JIF标准也存在一些缺陷，因此JIF并没有被推广开来。后来出现的“</strong>JPEG File Interchange Format</strong> (JFIF)” 和 “**Exchange image file Format(**Exif)” 等新的存储格式成为了主流。Exif 和 JFIF 都是遵循 JIF标准的，两者只是在JIF的基础上增加了一些各自的Marker。</p>
<ul>
<li>JPEG是压缩标准，JPEG&#x2F;JFIF和JPEG&#x2F;Exif是文件格式标准，不是一个概念，需要注意区分。</li>
<li>JPEG&#x2F;Exif文件格式标准是Camera产业联合会发布，主要用于摄像设备上，摄像产业把Exif作为行业的元数据（metadata)交换格式</li>
<li>JPEG&#x2F;JFIF文件格式标准是为了方便JPEG压缩图像在广泛的平台和应用间以最小的存储空间代价进行交换而设计的，它不包含JPEG&#x2F;TIFF标准任何高级特性。</li>
</ul>
<h2 id="1-图片元数据（Metadata）"><a href="#1-图片元数据（Metadata）" class="headerlink" title="1. 图片元数据（Metadata）"></a><font size=3>1. 图片元数据（Metadata）</font></h2><p>元数据（Metadata），又称中介数据、中继数据，为描述数据的数据（data about data），主要是描述数据属性（property）的信息。用来支持如指示存储位置、历史数据、资源查找、文件记录等功能。</p>
<p>图片元数据（Metadata） 是嵌入到图片文件中的一些标签。比较像文件属性，但是种类繁多。对于数码图像，目前常见的研数据有EXIF, IPTC和XMP三种：</p>
<ul>
<li>EXIF：通常被数码相机在拍摄照片时自动添加，比如相机型号、镜头、曝光、图片尺寸等信息</li>
<li>IPTF：比如图片标题、关键字、说明、作者、版权等信息。主要是由人工在后期通过软件写入的数据。</li>
<li>XMP：XMP实际上是一种元数据存储和管理的标准，可以将Exif，IPTC或其他的数据都按XMP统一的格式存放在图像文件中。 但是当將JPG转换为其它格式如png， pdf等时，由于这些格式都不支持Exif格式，所以Exif信息就会丢失。为了解决这个问题，Adobe公司推出用XMP管理元数据的方法，即将图像中的元数据如Exif，IPTC等都纳入XMP库中，由XMP管理。</li>
</ul>
<p>元数据的嵌入方式因图像格式而异，不同格式的图像文件有不同的嵌入方式。如JPG、TIF就是EXIF。</p>
<h2 id="2-Exif是什么？"><a href="#2-Exif是什么？" class="headerlink" title="2. Exif是什么？"></a><font size=3>2. Exif是什么？</font></h2><p>Exif为<strong>Exchangeable Image File</strong>(可交换图像文件)的缩写，是专门为数码相机的照片设定的，就是用来记录拍摄图像时的各种信息：图像信息（厂商，分辨率等），相机拍摄记录（ISO，白平衡，饱和度，锐度等），缩略图（缩略图宽度，高度等），gps（拍摄时的经度，纬度，高度）等，将这些信息按照JPEG文件标准放在图像文件头部。</p>
<blockquote>
<p>Exif所记录主要的几类信息：</p>
<ul>
<li>拍摄信息</li>
<li>拍摄器材（机身、镜头、闪光灯等）</li>
<li>拍摄参数（快门速度、光圈F值、ISO速度、焦距、测光模式等）</li>
<li>图像处理数（锐化、对比度、饱和度、白平衡等）</li>
<li>图像描述及版权信息</li>
<li>GPS定位数据</li>
<li>缩略图</li>
</ul>
<p>Exif最初由日本电子工业发展协会(JEIDA –J<strong>apan Electronic Industry Development Association)</strong> 在1996年制定(1.0)，1998年省级到了2.1版本，增加对了音频文件的支持。目前的最新版本是2.21 版。国际标准化组织(ISO)正在制订的相机文件设计标准（DCF – Design role for Camera File system&#x2F;相机文件系统设计规则）可能以Exif2.1为基础。</p>
<p>目前几乎新型的数码相机都使用Exif文件格式来存储图像. </p>
</blockquote>
<h2 id="3-EXIF与JPEG的关系"><a href="#3-EXIF与JPEG的关系" class="headerlink" title="3. EXIF与JPEG的关系"></a><font size=3>3. EXIF与JPEG的关系</font></h2><blockquote>
<p>Basically, <strong>Exif file format is the same as JPEG file format</strong>. Exif inserts some of image&#x2F;digicam information data and thumbnail image to JPEG in conformity to JPEG specification.Therefore you can view Exif format image files by JPEG compliant Internet browser&#x2F;Picture viewer&#x2F;Photo retouch software etc. as a usual JPEG image files.</p>
</blockquote>
<p><strong>Exif 文件实际是JPEG文件的一种，遵从JPEG标准</strong>，因此加入 EXIF 信息并不影响 JPEG 文件的查看。只是在文件头信息中增加了有关拍摄信息的内容和索引图。所以我们可以使用任何支持JPEG格式的图像工具软件观看或修改Exif文件，但打开时可能看不到Exif信息，一旦修改，Exif信息可能丢失。</p>
<p>简单来说，EXIF 信息就是由数码相机在拍摄过程中采集一系列的信息，然后把信息放置在我们熟知的 JPEG&#x2F;TIFF 文件的头部， 也就是说 EXIF 信息是镶嵌在 JPEG&#x2F;TIFF 图像文件格式内的一组拍摄参数，主要包括摄影时的光圈、快门、ISO、日期时间等各种与当时摄影条件相关的讯息，相机品牌型号，色彩编码，拍摄时录制的声音以及全球定位系统（GPS）等信息。</p>
<h2 id="4-JPEG两种文件结构的基本样式"><a href="#4-JPEG两种文件结构的基本样式" class="headerlink" title="4. JPEG两种文件结构的基本样式"></a><font size=3>4. JPEG两种文件结构的基本样式</font></h2><p>前面我们知道JPEG文件是由各种段组成：</p>
<table>
<thead>
<tr>
<th align="center">Marker名称</th>
<th align="center">Marker内容</th>
<th align="left">说明</th>
</tr>
</thead>
<tbody><tr>
<td align="center">SOI</td>
<td align="center">0xFFD8</td>
<td align="left">Start Of Image</td>
</tr>
<tr>
<td align="center">SOF0</td>
<td align="center">0xFFC0</td>
<td align="left">Start Of Frame 0</td>
</tr>
<tr>
<td align="center">SOF2</td>
<td align="center">0xFFC2</td>
<td align="left">Start of Frame 2</td>
</tr>
<tr>
<td align="center">DHT</td>
<td align="center">0xFFC4</td>
<td align="left">Define Huffman Table(s)</td>
</tr>
<tr>
<td align="center">DQT</td>
<td align="center">0xFFDB</td>
<td align="left">Define Quantization Table(s)</td>
</tr>
<tr>
<td align="center">DRI</td>
<td align="center">0xFFDD</td>
<td align="left">Define Restart Interval</td>
</tr>
<tr>
<td align="center">SOS</td>
<td align="center">0xFFDA</td>
<td align="left">Start of Scan</td>
</tr>
<tr>
<td align="center">RST0~RST7</td>
<td align="center">0xFFD0 ~ 0xFFD7</td>
<td align="left">Restart</td>
</tr>
<tr>
<td align="center">APP0~APP15</td>
<td align="center">0xFFE0 ~ 0xFFEF</td>
<td align="left">Application-sepcific</td>
</tr>
<tr>
<td align="center">COM</td>
<td align="center">0xFFFE</td>
<td align="left">Comment</td>
</tr>
<tr>
<td align="center">EOI</td>
<td align="center">0xFFD9</td>
<td align="left">End of Image</td>
</tr>
</tbody></table>
<p>0xFFE0~0xFFEF之间的标记被叫做 “应用标记”, 它们在JPEG图像解码中不是必须存在的. 它们被使用于用户的应用程序之中。例如, 老款的olympus&#x2F;canon&#x2F;casio&#x2F;agfa 数字相机使用 JFIF(JPEG文件交换格式&#x2F;JPEG File Interchange Format)来存储图像。 JFIF 使用 APP0(0xFFE0) 标记来插入数字相机的配置信息数据和缩略图。Exif和JFIF的文件结构比较如下：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/image-20241012070650615.png" alt="image-20241012070650615"  />

<p>其实大部分字段都是一样的，主要区别就在APP0和APP1：</p>
<ul>
<li><strong>This is APP0</strong></li>
</ul>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/image-20241012192911174.png" alt="image-20241012192911174" />

<ul>
<li><strong>This is APP1</strong></li>
</ul>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/image-20241012200228532.png" alt="image-20241012200228532" />

<p>可以看到APP1明显多了很多的数据。</p>
<h1 id="二、Exif文件格式说明"><a href="#二、Exif文件格式说明" class="headerlink" title="二、Exif文件格式说明"></a><font size=3>二、Exif文件格式说明</font></h1><p>上面已经大概了解了Exif的文件格式，接下来就来详细学习一下Exif文件格式。</p>
<h2 id="1-JPEG-format-and-Marker"><a href="#1-JPEG-format-and-Marker" class="headerlink" title="1. JPEG format and Marker"></a><font size=3>1. JPEG format and Marker</font></h2><p>复习一下JPEG的文件格式和标记：每个JPEG文件从二进制值’0xFFD8’开始，以二进制值’0xFFD9’结束。JPEG数据中有一些二进制0xFFXX数据，它们被称为“Marker”，是JPEG数据段的标识。0xFFD8表示SOI(图像开始)，0xFFD9表示EOI(图像结束)。这两个特殊的marker后面没有数据，其他的marker后面有数据。Marker的基本格式如下:</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">0xFF+Marker Number(1 byte)+Data size(2 bytes)+Data(n bytes)</span><br></pre></td></tr></table></figure>

<p>在JPEG格式中，由一些标记描述数据，例如，SOS表示数据流的开始，SOS标记后面，JPEG图像流开始并由EOI标记终止。</p>
<table border="1">
  <tbody>
  <tr>
    <td>SOI Marker</td>
    <td colspan="3">Marker XX <br>size=SSSS</td>
    <td colspan="3">Marker YY <br>size=TTTT</td>
    <td colspan="3">SOS Marker <br>size=UUUU</td>
    <td>Image stream</td>
    <td>EOI Marker</td></tr>
  <tr>
    <td>FFD8</td>
    <td>FFXX</td>
    <td>SSSS</td>
    <td>DDDD......</td>
    <td>FFYY</td>
    <td>TTTT</td>
    <td>DDDD......</td>
    <td>FFDA</td>
    <td>UUUU</td>
    <td>DDDD....</td>
    <td>I I I I....</td>
    <td>FFD9</td></tr></tbody></table>
这里面各个段这里就不详细学习了，除了APP1与JFIF相差较大，其他的段都是一样的。后面详细来学习APP1段。

<h2 id="2-Exif-data-structure"><a href="#2-Exif-data-structure" class="headerlink" title="2. Exif data structure"></a><font size=3>2. Exif data structure</font></h2><p>Exif数据(APP1)的大致结构如下：</p>
<table border="1">
  <tbody>
  <tr>
    <td>FFE1</td>
    <td colspan="3">APP1 Marker</td></tr>
  <tr>
    <td>SSSS</td>
    <td rowspan="13">APP1 Data</td>
    <td colspan="2">APP1 Data Size</td></tr>
  <tr>
    <td>45786966 0000</td>
    <td colspan="2">Exif Header</td></tr>
  <tr>
    <td>49492A00 08000000</td>
    <td colspan="2">TIFF Header</td></tr>
  <tr>
    <td>XXXX. . . . </td>
    <td rowspan="2">IFD0 (main image)</td>
    <td>Directory</td></tr>
  <tr>
    <td>LLLLLLLL</td>
    <td>Link to IFD1</td></tr>
  <tr>
    <td>XXXX. . . . </td>
    <td colspan="2">Data area of IFD0</td></tr>
  <tr>
    <td>XXXX. . . . </td>
    <td rowspan="2">Exif SubIFD</td>
    <td>Directory</td></tr>
  <tr>
    <td>00000000</td>
    <td>End of Link</td></tr>
  <tr>
    <td>XXXX. . . . </td>
    <td colspan="2">Data area of Exif SubIFD</td></tr>
  <tr>
    <td>XXXX. . . . </td>
    <td rowspan="2">IFD1(thumbnail image)</td>
    <td>Directory</td></tr>
  <tr>
    <td>00000000</td>
    <td>End of Link</td></tr>
  <tr>
    <td>XXXX. . . . </td>
    <td colspan="2">Data area of IFD1</td></tr>
  <tr>
    <td>FFD8XXXX. . . XXXXFFD9</td>
    <td colspan="2">Thumbnail image</td></tr></tbody></table>

<p>其实就是这张表：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/image-20241012200228532.png" alt="image-20241012200228532" />

<h3 id="2-1-APP1标记"><a href="#2-1-APP1标记" class="headerlink" title="2.1 APP1标记"></a><font size=3>2.1 APP1标记</font></h3><p>APP1的标记就是 FF E1，占2个字节。</p>
<h3 id="2-2-APP1段长度"><a href="#2-2-APP1段长度" class="headerlink" title="2.2 APP1段长度"></a><font size=3>2.2 APP1段长度</font></h3><p>APP1这个段的长度占2个字节，不包含APP1标记。</p>
<h3 id="2-3-标识符"><a href="#2-3-标识符" class="headerlink" title="2.3 标识符"></a><font size=3>2.3 标识符</font></h3><p>接着是6个字节的Exif标识，就是 <code>E</code>、 <code>x</code>、 <code>i</code>、 <code>f </code>的ASCII码。</p>
<h3 id="2-4-TIFF-Header"><a href="#2-4-TIFF-Header" class="headerlink" title="2.4 TIFF Header"></a><font size=3>2.4 TIFF Header</font></h3><p>接下来是8个字节的TIFF头，它的结构如下：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/image-20241012201052704.png" alt="image-20241012201052704" />

<ul>
<li>Byte align</li>
</ul>
<p>最开始的2个字节定义了 TIFF 数据的字节序。 如果这个值是 0x4949&#x3D;”I I”的话, 就表示按照 “Intel” 的字节序(Little Endian，小端存储) 来排列数据. 如果是 0x4d4d&#x3D;”MM”, 则说明按照 “Motorola” 的字节序(Big Endian，大端存储)来排列数据。</p>
<p>例如, 这个值是’305,419,896’ (注意：16进制值为0x12345678). 在 Motorola 的 字节序中, 数据存储时的排列顺序为 0x12, 0x34, 0x56, 0x78 。而用 Intel 的字节序的话, 它就是按照 0x78, 0x56, 0x34, 0x12 来排序数据。</p>
<p>几乎所有的数字相机都是使用 Intel 的字节序。不过 Ricoh 使用的是 Motorola 的。Sony 使用的是 Intel 字节序(除了 D700)。 Kodak 的DC200&#x2F;210&#x2F;240 使用的是 Motorola 字节序, 但是 DC220&#x2F;260 使用的是 Intel的, 尽管它们都是使用在 PowerPC的平台上! 因此当我们需要使用 Exif 数据的值的时候, 我们必须每次都要检查它的字节序。 尽管 JPEG 数据仅仅是使用 Motorola 字节序, 但 Exif 却是允许这两种字节序存在的。</p>
<blockquote>
<p><strong>注意：字节序直接影响到数据内容，所以在解析Exif数据前必须检查文件的Byte align</strong></p>
</blockquote>
<ul>
<li>TAG Mark</li>
</ul>
<p>随后的两个字节是一个2字节长度的固定值 0x002a. 如果数据使用 Intel 字节序, 则这两个 字节的数据排列为 “0x2a, 0x00”. 如果是Motorola 的, 则是 “0x00, 0x2a”。</p>
<ul>
<li>offset to first IFD</li>
</ul>
<p>TIFF头的最后的 4个字节是到第一个 IFD(Image File Directory，图像文件目录)的偏移量，这里的第一个IFD其实就是IFD0。这个偏移量是指从TIFF头(“II” 或者 “MM”)开始，包含自己偏移量值的本身, 到下一个IFD为止，长度的字节数（这三句其实说的有点绕，简单说就是，这个偏移是从TIFF头开始的位置计算的）。通常地第一个 IFD 是紧挨着 TIFF 头出现的, 因此这个偏移量的值是 0x00000008。</p>
<p>IFD是一个链表结构，如下图所示。在每个IFD的末尾包含一个指向下一个IFD的偏移量（同样是从TIFF Header算起），如果这个偏移量为0，则表示已经到了链表的末尾。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/3a2859ea374bf7386a2f2c019b4701f5.png" alt="img" />

<p>在Exif格式中，只有两个标准IFD。第一个IFD 是IFD0(主图像IFD), 然后它连接到IFD1(缩略图IFD) ，并且IFD 连接在此结束。IFD0&#x2F;IFD1 不包含任何的数字相机的信息，例如快门速度, 焦距等。</p>
<p>在IFD0中除了自己的DE（Directory Entry）外，还包括了EXIF自定义的EXIF Sub IFD、GPS IFD，而EXIF sub IFD中又进一步包括了Interoperability IFD（简称IOP）和MakerNote IFD。EXIF自定义IFD的结构与标准TIFF IFD相同，但不是记录于TIFF的IFD链表中，而是 作为TIFF IFD的子链表形式存在（因为扩展IFD里定义了不同于TIFF标准的Tag，这样为了与标准的TIFF格式区分），使得原来的TIFF IFD链表结构变成了树形结构 。（这里的TIFF文件结构就没有去详细学习了，见的也不多，这里大概能理解就行了）</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/92aa276e25a6f7c1f193da515bdf5a76.png" alt="img" />





<h3 id="2-5-IFD——Image-File-Directory"><a href="#2-5-IFD——Image-File-Directory" class="headerlink" title="2.5 IFD——Image File Directory"></a><font size=3>2.5 IFD——Image File Directory</font></h3><h4 id="2-5-1-格式说明"><a href="#2-5-1-格式说明" class="headerlink" title="2.5.1 格式说明"></a><font size=3>2.5.1 格式说明</font></h4><p>根据 TIFF Header 的后四个字节，我们可以找到第一个 IFD(Image File Directory)。IFD的数据结构如下表所示。每个IFD结构中存在多个Directory Entry，每个Entry记录着图片的一条属性信息，比如拍摄时间、拍摄机器、图片尺寸等等。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/LV01-%E5%9B%BE%E5%83%8F-03-%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F-03-04-JPEG%E4%B8%AD%E7%9A%84Exif%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F%E6%A0%87%E5%87%86/img/image-20241012215710503.png" alt="image-20241012215710503" />

<ul>
<li>Number of Directory Entry</li>
</ul>
<p>IFD结构的头两个字节存储 entry 的个数。</p>
<ul>
<li>Directory Entry n</li>
</ul>
<p>每一个 Directory Entry 的长度固定为12个字节，分为4个部分：</p>
<p>（1）两个字节 TTTT 对应的内容为  Tag number。</p>
<p>（2）紧接着的两个字节 FFFF 对应的内容为 Directory Entry存储内容的类型(Component Type)，其实应该说是数据格式才对，就是这一个组件的类型，不同的类型占不同的字节数。</p>
<p>（3）后面四个字节 NNNNNNNN 存储的是 Directory Entry 对应的Component的数量，再通过每个组件的数据格式，就可以知道这个Directory Entry数据占多少个字节了。</p>
<p>（4）最后的四个字节 DDDDDDDD  存储的可能是Directory Entry对应的值也可能是偏移地址，当Entry对应的值的长度超过四个字节，那么 DDDDDDDD 存储的是对应的值的偏移地址（该偏移寻址的基址也是TIFF HEADER的起始位置）。</p>
<blockquote>
<p>总长度计算公式 总长度 &#x3D; Component 数量 x 每个Component的字节数</p>
</blockquote>
<ul>
<li>offset to next IFD</li>
</ul>
<p>占4个字节，表示到下一个IFD的偏移量，当是最后一个IFD时，这里为0。</p>
<ul>
<li>Directory Entry Data area</li>
</ul>
<p>这里存放的是Directory Entry的值，根据前面的数据长度和偏移地址可以找到每一个Directory Entry的数据。</p>
<h4 id="2-5-2-data-format"><a href="#2-5-2-data-format" class="headerlink" title="2.5.2 data format"></a><font size=3>2.5.2 data format</font></h4><table border="1">
    <tbody>
        <tr>
            <td align="center">Value</td>
            <td align="center">1</td>
            <td align="center"v>2</td>
            <td align="center">3</td>
            <td align="center">4</td>
            <td align="center">5</td>
            <td align="center">6</td>
        </tr>
        <tr>
            <td align="center">Format</td>
            <td align="center">unsigned byte</td>
            <td align="center">ascii strings</td>
            <td align="center">unsigned short</td>
            <td align="center"v>unsigned long</td>
            <td align="center">unsigned rational</td>
            <td align="center">signed byte</td>
        </tr>
        <tr>
            <td align="center">Bytes/component</td>
            <td align="center">1</td>
            <td align="center">1</td>
            <td align="center">2</td>
            <td align="center">4</td>
            <td align="center">8</td>
            <td align="center">1</td>
        </tr>
        <tr>
            <td colspan="7"></td>
        </tr>
        <tr>
            <td align="center">Value</td>
            <td align="center">7</td>
            <td align="center">8</td>
            <td align="center">9</td>
            <td align="center">10</td>
            <td align="center">11</td>
            <td align="center">12</td>
        </tr>
        <tr>
            <td align="center">Format</td>
            <td align="center">undefined</td>
            <td align="center">signed short</td>
            <td align="center">signed long</td>
            <td align="center">signed rational</td>
            <td align="center">single float</td>
            <td align="center">double float</td>
        </tr>
        <tr>
            <td align="center">Bytes/component</td>
            <td align="center">1</td>
            <td align="center">2</td>
            <td align="center">4</td>
            <td align="center">8</td>
            <td align="center">4</td>
            <td align="center">8</td>
        </tr>
    </tbody>
</table>

<h4 id="2-5-3-Tag-number"><a href="#2-5-3-Tag-number" class="headerlink" title="2.5.3 Tag number"></a><font size=3>2.5.3 Tag number</font></h4><h5 id="2-5-3-1-IFD0中常见的Tags"><a href="#2-5-3-1-IFD0中常见的Tags" class="headerlink" title="2.5.3.1 IFD0中常见的Tags"></a><font size=3>2.5.3.1 IFD0中常见的Tags</font></h5><details class="folding-tag" blue><summary> 点击查看详情 </summary>
              <div class='content'>
              <table border="1">    <tbody>        <tr>            <td colspan="5"><center><font size="+1"><b>Tags used by IFD0 (main image)</b></font></center></td>        </tr>        <tr>            <td>Tag No.</td>            <td>Tag Name</td>            <td>Format</td>            <td>CompoNo</td>            <td>Desc.</td>        </tr>        <tr>            <td>0x010e</td>            <td>ImageDescription </td>            <td>ascii string</td>            <td><br></td>            <td>Describes image</td>        </tr>        <tr>            <td>0x010f</td>            <td>Make </td>            <td>ascii string</td>            <td><br></td>            <td>Shows manufacturer of digicam</td>        </tr>        <tr>            <td>0x0110</td>            <td>Model </td>            <td>ascii string</td>            <td><br></td>            <td>Shows model number of digicam</td>        </tr>        <tr>            <td>0x0112</td>            <td>Orientation </td>            <td>unsigned short</td>            <td>1 </td>            <td>The orientation of the camera relative to the scene, when the image             was captured. The start point of stored data is, '1' means upper left, '3'             lower right, '6' upper right, '8' lower left, '9' undefined.</td>        </tr>        <tr>            <td>0x011a</td>            <td>XResolution </td>            <td>unsigned rational</td>            <td>1 </td>            <td rowspan="2">Display/Print resolution of image. Large number of digicam             uses 1/72inch, but it has no mean because personal computer doesn't use             this value to display/print out.</td>            </tr>        <tr>            <td>0x011b</td>            <td>YResolution </td>            <td>unsigned rational</td>            <td>1 </td>        </tr>        <tr>            <td>0x0128</td>            <td>ResolutionUnit </td>            <td>unsigned short</td>            <td>1 </td>            <td>Unit of XResolution(0x011a)/YResolution(0x011b). <font color="#c02020">'1' means no-unit,</font> '2' means inch, '3' means         centimeter.</td>        </tr>        <tr>            <td>0x0131</td>            <td>Software </td>            <td>ascii string</td>            <td><br></td>            <td>Shows firmware(internal software of digicam) version number.</td>        </tr>        <tr>            <td>0x0132</td>            <td>DateTime </td>            <td>ascii string</td>            <td>20 </td>            <td>Date/Time of image was last modified. Data format is "YYYY:MM:DD             HH:MM:SS"+0x00, total 20bytes. In usual, it has the same value of             DateTimeOriginal(0x9003)</td>        </tr>        <tr>            <td>0x013e</td>            <td>WhitePoint </td>            <td>unsigned rational</td>            <td>2 </td>            <td>Defines chromaticity of white point of the image. If the image uses             CIE Standard Illumination D65(known as international standard of             'daylight'), the values are '3127/10000,3290/10000'.</td>        </tr>        <tr>            <td>0x013f</td>            <td>PrimaryChromaticities </td>            <td>unsigned rational</td>            <td>6 </td>            <td>Defines chromaticity of the primaries of the image. If the image uses             CCIR Recommendation 709 primearies, values are             '640/1000,330/1000,300/1000,600/1000,150/1000,0/1000'.</td>        </tr>        <tr>            <td>0x0211</td>            <td>YCbCrCoefficients </td>            <td>unsigned rational</td>            <td>3 </td>            <td>When image format is YCbCr, this value shows a constant to translate             it to RGB format. In usual, values are '0.299/0.587/0.114'.</td>        </tr>        <tr>            <td>0x0213</td>            <td>YCbCrPositioning </td>            <td>unsigned short</td>            <td>1 </td>            <td>When image format is YCbCr and uses 'Subsampling'(cropping of chroma             data, all the digicam do that), defines the chroma sample point of             subsampling pixel array. '1' means the center of pixel array, '2' means             the datum point.</td>        </tr>        <tr>            <td>0x0214</td>            <td>ReferenceBlackWhite </td>            <td>unsigned rational</td>            <td>6 </td>            <td>Shows reference value of black point/white point. In case of YCbCr             format, first 2 show black/white of Y, next 2 are Cb, last 2 are Cr. In             case of RGB format, first 2 show black/white of R, next 2 are G, last 2             are B.</td>        </tr>        <tr>            <td>0x8298</td>            <td>Copyright </td>            <td>ascii string</td>            <td><br></td>            <td>Shows copyright information</td>        </tr>        <tr>            <td>0x8769</td>            <td>ExifOffset </td>            <td>unsigned long</td>            <td>1 </td>            <td>Offset to Exif Sub IFD</td>        </tr>    </tbody></table>
              </div>
            </details>

<h5 id="2-5-3-2-Exif-SubIFD中常见的Tags"><a href="#2-5-3-2-Exif-SubIFD中常见的Tags" class="headerlink" title="2.5.3.2  Exif SubIFD中常见的Tags"></a><font size=3>2.5.3.2  Exif SubIFD中常见的Tags</font></h5><details class="folding-tag" blue><summary> 点击查看详情 </summary>
              <div class='content'>
              <table border="1">    <tbody>        <tr>            <td colspan="5">            <center><font size="+1"><b>Tags used by Exif SubIFD</b></font></center></td>        </tr>        <tr>            <td>Tag No.</td>            <td>Tag Name</td>            <td>Format</td>            <td>CompoNo</td>            <td>Desc.</td>        </tr>        <tr>            <td>0x829a</td>            <td>ExposureTime </td>            <td>unsigned rational</td>            <td>1 </td>            <td>Exposure time (reciprocal of shutter speed). Unit is second.</td>        </tr>        <tr>            <td>0x829d</td>            <td>FNumber </td>            <td>unsigned rational</td>            <td>1 </td>            <td>The actual F-number(F-stop) of lens when the image was taken.</td>        </tr>        <tr>            <td>0x8822</td>            <td>ExposureProgram </td>            <td>unsigned short</td>            <td>1 </td>            <td>Exposure program that the camera used when image was taken. '1' means             manual control, '2' program normal, '3' aperture priority, '4' shutter             priority, '5' program creative (slow program), '6' program             action(high-speed program), '7' portrait mode, '8' landscape mode.</td></tr>        <tr>            <td>0x8827</td>            <td>ISOSpeedRatings </td>            <td>unsigned short</td>            <td>2 </td>            <td>CCD sensitivity equivalent to Ag-Hr film speedrate.</td>        </tr>        <tr>            <td>0x9000</td>            <td>ExifVersion </td>            <td>undefined</td>            <td>4 </td>            <td>Exif version number. Stored as 4bytes of ASCII character (like "0210")</td>        </tr>        <tr>            <td>0x9003</td>            <td>DateTimeOriginal </td>            <td>ascii string</td>            <td>20 </td>            <td>Date/Time of original image taken. This value should not be modified             by user program.</td>        </tr>        <tr>            <td>0x9004</td>            <td>DateTimeDigitized </td>            <td>ascii string</td>            <td>20 </td>            <td>Date/Time of image digitized. Usually, it contains the same value of             DateTimeOriginal(0x9003).</td>        </tr>        <tr>            <td>0x9101</td>            <td>ComponentConfiguration </td>            <td>undefined</td>            <td><br></td>            <td>Unknown. It seems value 0x00,0x01,0x02,0x03 always.</td></tr>        <tr>            <td>0x9102</td>            <td>CompressedBitsPerPixel </td>            <td>unsigned rational</td>            <td>1 </td>            <td>The average compression ratio of JPEG.</td>        </tr>        <tr>            <td>0x9201</td>            <td>ShutterSpeedValue </td>            <td>signed rational</td>            <td>1 </td>            <td>Shutter speed. To convert this value to ordinary 'Shutter Speed';             calculate this value's power of 2, then reciprocal. For example, if value             is '4', shutter speed is 1/(2^4)=1/16 second.</td>        </tr>        <tr>            <td>0x9202</td>            <td>ApertureValue </td>            <td>unsigned rational</td>            <td>1 </td>            <td>The actual aperture value of lens when the image was taken. To convert             this value to ordinary F-number(F-stop), calculate this value's power of             root 2 (=1.4142). For example, if value is '5', F-number is 1.4142^5 =             F5.6.</td>        </tr>        <tr>            <td>0x9203</td>            <td>BrightnessValue </td>            <td>signed rational</td>            <td>1 </td>            <td>Brightness of taken subject, unit is EV.</td>        </tr>        <tr>            <td>0x9204</td>            <td>ExposureBiasValue </td>            <td>signed rational</td>            <td>1 </td>            <td>Exposure bias value of taking picture. Unit is EV.</td>        </tr>        <tr>            <td>0x9205</td>            <td>MaxApertureValue </td>            <td>unsigned rational</td>            <td>1 </td>            <td>Maximum aperture value of lens. You can convert to F-number by             calculating power of root 2 (same process of ApertureValue(0x9202).</td>        </tr>        <tr>            <td>0x9206</td>            <td>SubjectDistance </td>            <td>signed rational</td>            <td>1 </td>            <td>Distance to focus point, unit is meter.</td>        </tr>        <tr>            <td>0x9207</td>            <td>MeteringMode </td>            <td>unsigned short</td>            <td>1 </td>            <td>Exposure metering method. '1' means average, '2' center weighted             average, '3' spot, '4' multi-spot, '5' multi-segment.</td>        </tr>        <tr>            <td>0x9208</td>            <td>LightSource </td>            <td>unsigned short</td>            <td>1 </td>            <td>Light source, actually this means white balance setting. '0' means             auto, '1' daylight, '2' fluorescent, '3' tungsten, '10' flash.</td>        </tr>        <tr>            <td>0x9209</td>            <td>Flash </td>            <td>unsigned short</td>            <td>1 </td>            <td>'1' means flash was used, '0' means not used.</td>        </tr>        <tr>            <td>0x920a</td>            <td>FocalLength </td>            <td>unsigned rational</td>            <td>1 </td>            <td>Focal length of lens used to take image. Unit is millimeter.</td>        </tr>        <tr>            <td>0x927c</td>            <td>MakerNote </td>            <td>undefined</td>            <td><br></td>            <td>Maker dependent internal data. Some of maker such as             Olympus/Nikon/Sanyo etc. uses IFD format for this area.</td>        </tr>        <tr>            <td>0x9286</td>            <td>UserComment </td>            <td>undefined</td>            <td><br></td>            <td>Stores user comment.</td>        </tr>        <tr>            <td>0xa000</td>            <td>FlashPixVersion </td>            <td>undefined</td>            <td>4 </td>            <td>Stores FlashPix version. Unknown but 4bytes of ASCII characters "0100"exists.</td>        </tr>        <tr>            <td>0xa001</td>            <td>ColorSpace </td>            <td>unsigned short</td>            <td>1 </td>            <td>Unknown, value is '1'.</td>        </tr>        <tr>            <td>0xa002</td>            <td>ExifImageWidth </td>            <td>unsigned <font color="#c02020">short/</font>long</td>            <td>1 </td>            <td rowspan="2">Size of main image.</td>        </tr>        <tr>            <td>0xa003</td>            <td>ExifImageHeight </td>            <td>unsigned <font color="#c02020">short/</font>long</td>            <td>1 </td>        </tr>        <tr>            <td>0xa004</td>            <td>RelatedSoundFile </td>            <td>ascii string</td>            <td><br></td>            <td>If this digicam can record audio data with image, shows name of audio             data.</td></tr>        <tr>            <td>0xa005</td>            <td>ExifInteroperabilityOffset </td>            <td>unsigned long</td>            <td>1 </td>            <td>Extension of "ExifR98", detail is unknown. This value is offset to IFD             format data. Currently there are 2 directory entries, first one is             Tag0x0001, value is "R98", next is Tag0x0002, value is "0100".</td>        </tr>        <tr>            <td>0xa20e</td>            <td>FocalPlaneXResolution </td>            <td>unsigned rational</td>            <td>1 </td>            <td rowspan="2">CCD's pixel density.</td>        </tr>        <tr>            <td>0xa20f</td>            <td>FocalPlaneYResolution </td>            <td>unsigned rational</td>            <td>1 </td>        </tr>        <tr>            <td>0xa210</td>            <td>FocalPlaneResolutionUnit </td>            <td>unsigned short</td>            <td>1 </td>            <td>Unit of FocalPlaneXResoluton/FocalPlaneYResolution. <font color="#c02020">'1' means no-unit, '2' inch, '3' centimeter.</font></td>        </tr>        <tr>            <td>0xa217</td>            <td>SensingMethod </td>            <td>unsigned short</td>            <td>1 </td>            <td>Shows type of image sensor unit. '2' means 1 chip color area sensor,             most of all digicam use this type.</td>        </tr>        <tr>            <td>0xa300</td>            <td>FileSource </td>            <td>undefined</td>            <td>1 </td>            <td>Unknown but value is '3'.</td>        </tr>        <tr>            <td>0xa301</td>            <td>SceneType </td>            <td>undefined</td>            <td>1 </td>            <td>Unknown but value is '1'.</td>        </tr>    </tbody></table>
              </div>
            </details>

<h5 id="2-5-3-3-IFD1中常见的tags"><a href="#2-5-3-3-IFD1中常见的tags" class="headerlink" title="2.5.3.3 IFD1中常见的tags"></a><font size=3>2.5.3.3 IFD1中常见的tags</font></h5><details class="folding-tag" blue><summary> 点击查看详情 </summary>
              <div class='content'>
              <table border="1">    <tbody>        <tr>            <td colspan="5">                <center>                    <font size="+1"><b>Tags used by IFD1 (thumbnail image)</b></font>                </center>            </td>        </tr>        <tr>            <td>Tag No.</td>            <td>Tag Name</td>            <td>Format</td>            <td>CompoNo</td>            <td>Desc.</td>        </tr>        <tr>            <td>0x0100</td>            <td>ImageWidth </td>            <td>unsigned <font color="#c02020">short/</font>long</td>            <td>1 </td>            <td rowspan="2">Shows size of thumbnail image.</td>        </tr>        <tr>            <td>0x0101</td>            <td>ImageLength </td>            <td>unsigned <font color="#c02020">short/</font>long</td>            <td>1 </td>        </tr>        <tr>            <td>0x0102</td>            <td>BitsPerSample </td>            <td>unsigned short</td>            <td>3 </td>            <td>When image format is no compression, this value shows the number of                bits per component for each pixel. Usually this value is '8,8,8'</td>        </tr>        <tr>            <td>0x0103</td>            <td>Compression </td>            <td>unsigned short</td>            <td>1 </td>            <td>Shows compression method. '1' means no compression, '6' means JPEG                compression.</td>        </tr>        <tr>            <td>0x0106</td>            <td>PhotometricInterpretation </td>            <td>unsigned short</td>            <td>1 </td>            <td>Shows the color space of the image data components. '1' means                monochrome, '2' means RGB, '6' means YCbCr.</td>        </tr>        <tr>            <td>0x0111</td>            <td>StripOffsets </td>            <td>unsigned <font color="#c02020">short/</font>long</td>            <td><br></td>            <td>When image format is no compression, this value shows offset to image                data. In some case image data is striped and this value is plural.</td>        </tr>        <tr>            <td>0x0115</td>            <td>SamplesPerPixel </td>            <td>unsigned short</td>            <td>1 </td>            <td>When image format is no compression, this value shows the number of                components stored for each pixel. At color image, this value is '3'.</td>        </tr>        <tr>            <td>0x0116</td>            <td>RowsPerStrip </td>            <td>unsigned short<font color="#c02020">/long</font>            </td>            <td>1 </td>            <td>When image format is no compression and image has stored as strip,                this value shows how many rows stored to each strip. If image has not                striped, this value is the same as ImageLength(0x0101).</td>        </tr>        <tr>            <td>0x0117</td>            <td>StripByteConunts </td>            <td>unsigned <font color="#c02020">short/</font>long</td>            <td><br></td>            <td>When image format is no compression and stored as strip, this value                shows how many bytes used for each strip and this value is plural. If                image has not stripped, this value is single and means whole data size of                image.</td>        </tr>        <tr>            <td>0x011a</td>            <td>XResolution </td>            <td>unsigned rational</td>            <td>1 </td>            <td rowspan="2">Display/Print resolution of image. Large number of digicam                uses 1/72inch, but it has no mean because personal computer doesn't use                this value to display/print out.</td>        </tr>        <tr>            <td>0x011b</td>            <td>YResolution </td>            <td>unsigned rational</td>            <td>1 </td>        </tr>        <tr>            <td>0x011c</td>            <td>PlanarConfiguration </td>            <td>unsigned short</td>            <td>1 </td>            <td>When image format is no compression YCbCr, this value shows byte                aligns of YCbCr data. If value is '1', Y/Cb/Cr value is chunky format,                contiguous for each subsampling pixel. If value is '2', Y/Cb/Cr value is                separated and stored to Y plane/Cb plane/Cr plane format.</td>        </tr>        <tr>            <td>0x0128</td>            <td>ResolutionUnit </td>            <td>unsigned short</td>            <td>1 </td>            <td>Unit of XResolution(0x011a)/YResolution(0x011b). '1' means inch, '2'                means centimeter.</td>        </tr>        <tr>            <td>0x0201</td>            <td>JpegIFOffset </td>            <td>unsigned long</td>            <td>1 </td>            <td>When image format is JPEG, this value show offset to JPEG data                stored.</td>        </tr>        <tr>            <td>0x0202</td>            <td>JpegIFByteCount </td>            <td>unsigned long</td>            <td>1 </td>            <td>When image format is JPEG, this value shows data size of JPEG                image.</td>        </tr>        <tr>            <td>0x0211</td>            <td>YCbCrCoefficients </td>            <td>unsigned rational</td>            <td>3 </td>            <td>When image format is YCbCr, this value shows constants to translate it                to RGB format. In usual, '0.299/0.587/0.114' are used.</td>        </tr>        <tr>            <td>0x0212</td>            <td>YCbCrSubSampling </td>            <td>unsigned short</td>            <td>2 </td>            <td>When image format is YCbCr and uses subsampling(cropping of chroma                data, all the digicam do that), this value shows how many chroma data                subsampled. First value shows horizontal, next value shows vertical                subsample rate.</td>        </tr>        <tr>            <td>0x0213</td>            <td>YCbCrPositioning </td>            <td>unsigned short</td>            <td>1 </td>            <td>When image format is YCbCr and uses 'Subsampling'(cropping of chroma                data, all the digicam do that), this value defines the chroma sample point                of subsampled pixel array. '1' means the center of pixel array, '2' means                the datum point(0,0).</td>        </tr>        <tr>            <td>0x0214</td>            <td>ReferenceBlackWhite </td>            <td>unsigned rational</td>            <td>6 </td>            <td>Shows reference value of black point/white point. In case of YCbCr                format, first 2 show black/white of Y, next 2 are Cb, last 2 are Cr. In                case of RGB format, first 2 show black/white of R, next 2 are G, last 2                are B.</td>        </tr>    </tbody></table>
              </div>
            </details>

<h5 id="2-5-3-4-Misc-Tags"><a href="#2-5-3-4-Misc-Tags" class="headerlink" title="2.5.3.4 Misc Tags"></a><font size=3>2.5.3.4 Misc Tags</font></h5><details class="folding-tag" blue><summary> 点击查看详情 </summary>
              <div class='content'>
              <table border="1">    <tbody>        <tr>            <td colspan="5">                <center>                    <font size="+1"><b>Misc Tags</b></font>                </center>            </td>        </tr>        <tr>            <td>Tag No.</td>            <td>Tag Name</td>            <td>Format</td>            <td>CompoNo</td>            <td>Desc.</td>        </tr>        <tr>            <td>0x00fe</td>            <td>NewSubfileType </td>            <td>unsigned long</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0x00ff</td>            <td>SubfileType </td>            <td>unsigned short</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0x012d</td>            <td>TransferFunction </td>            <td>unsigned short</td>            <td>3 </td>            <td><br></td>        </tr>        <tr>            <td>0x013b</td>            <td>Artist </td>            <td>ascii string</td>            <td><br></td>            <td><br></td>        </tr>        <tr>            <td>0x013d</td>            <td>Predictor </td>            <td>unsigned short</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0x0142</td>            <td>TileWidth </td>            <td>unsigned short</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0x0143</td>            <td>TileLength </td>            <td>unsigned short</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0x0144</td>            <td>TileOffsets </td>            <td>unsigned long</td>            <td><br></td>            <td><br></td>        </tr>        <tr>            <td>0x0145</td>            <td>TileByteCounts </td>            <td>unsigned short</td>            <td><br></td>            <td><br></td>        </tr>        <tr>            <td>0x014a</td>            <td>SubIFDs </td>            <td>unsigned long</td>            <td><br></td>            <td><br></td>        </tr>        <tr>            <td>0x015b</td>            <td>JPEGTables </td>            <td>undefined</td>            <td><br></td>            <td><br></td>        </tr>        <tr>            <td>0x828d</td>            <td>CFARepeatPatternDim </td>            <td>unsigned short</td>            <td>2 </td>            <td><br></td>        </tr>        <tr>            <td>0x828e</td>            <td>CFAPattern </td>            <td>unsigned byte</td>            <td><br></td>            <td><br></td>        </tr>        <tr>            <td>0x828f</td>            <td>BatteryLevel </td>            <td>unsigned rational</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0x83bb</td>            <td>IPTC/NAA </td>            <td>unsigned long</td>            <td><br></td>            <td><br></td>        </tr>        <tr>            <td>0x8773</td>            <td>InterColorProfile </td>            <td>undefined</td>            <td><br></td>            <td><br></td>        </tr>        <tr>            <td>0x8824</td>            <td>SpectralSensitivity </td>            <td>ascii string</td>            <td><br></td>            <td><br></td>        </tr>        <tr>            <td>0x8825</td>            <td>GPSInfo </td>            <td>unsigned long</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0x8828</td>            <td>OECF </td>            <td>undefined</td>            <td><br></td>            <td><br></td>        </tr>        <tr>            <td>0x8829</td>            <td>Interlace </td>            <td>unsigned short</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0x882a</td>            <td>TimeZoneOffset </td>            <td>signed short</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0x882b</td>            <td>SelfTimerMode </td>            <td>unsigned short</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0x920b</td>            <td>FlashEnergy </td>            <td>unsigned rational</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0x920c</td>            <td>SpatialFrequencyResponse </td>            <td>undefined</td>            <td><br></td>            <td><br></td>        </tr>        <tr>            <td>0x920d</td>            <td>Noise </td>            <td>undefined</td>            <td><br></td>            <td><br></td>        </tr>        <tr>            <td>0x9211</td>            <td>ImageNumber </td>            <td>unsigned long</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0x9212</td>            <td>SecurityClassification </td>            <td>ascii string</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0x9213</td>            <td>ImageHistory </td>            <td>ascii string</td>            <td><br></td>            <td><br></td>        </tr>        <tr>            <td>0x9214</td>            <td>SubjectLocation </td>            <td>unsigned short</td>            <td>4 </td>            <td><br></td>        </tr>        <tr>            <td>0x9215</td>            <td>ExposureIndex </td>            <td>unsigned rational</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0x9216</td>            <td>TIFF/EPStandardID </td>            <td>unsigned byte</td>            <td>4 </td>            <td><br></td>        </tr>        <tr>            <td>0x9290</td>            <td>SubSecTime </td>            <td>ascii string</td>            <td><br></td>            <td><br></td>        </tr>        <tr>            <td>0x9291</td>            <td>SubSecTimeOriginal </td>            <td>ascii string</td>            <td><br></td>            <td><br></td>        </tr>        <tr>            <td>0x9292</td>            <td>SubSecTimeDigitized </td>            <td>ascii string</td>            <td><br></td>            <td><br></td>        </tr>        <tr>            <td>0xa20b</td>            <td>FlashEnergy </td>            <td>unsigned rational</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0xa20c</td>            <td>SpatialFrequencyResponse </td>            <td>unsigned short</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0xa214</td>            <td>SubjectLocation </td>            <td>unsigned short</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0xa215</td>            <td>ExposureIndex </td>            <td>unsigned rational</td>            <td>1 </td>            <td><br></td>        </tr>        <tr>            <td>0xa302</td>            <td>CFAPattern </td>            <td>undefined</td>            <td>1 </td>            <td><br></td>        </tr>    </tbody></table>
              </div>
            </details>

<h4 id="2-5-4-一个简单的实例"><a href="#2-5-4-一个简单的实例" class="headerlink" title="2.5.4 一个简单的实例"></a><font size=3>2.5.4 一个简单的实例</font></h4><p>在Exif格式中, 第一个IFD 是IFD0(主图像IFD)，然后它连接到IFD1(缩略图IFD) 并且IFD 连接在此结束。但是 IFD0&#x2F;IFD1 不包含任何的数字相机的信息例如快门速度, 焦距等。 </p>
<p>IFD0 总是包含一个特殊的标签 Exif偏移量(0x8769)，它表示到 Exif子IFD 的偏移量。 Exif子IFD 也是一个IFD 格式化的数据, 它包含了数字相机的信息。在扩展Exif格式(Exif2.1&#x2F;DCF)中, Exif子IFD还包含了特殊的标签 Exif Interoperability Offset (0xa005)。 这个偏移量也指向Interoperability IFD。根据 DCF 规格, 这个标签是必须的并且子IFD (主图像 IFD) 和 IFD1 (缩略图 IFD) 中可能也会包含Interoperability IFD。通常, 仅仅主图像仅仅有这个标签。 另外一些数字相机也为Makernote(制造商注释)使用 IFD 数据格式，这是生产商特定的魔数(magic number)区域。判断makernote 是否是IFD 格式是非常困难的, 必须仔细的编程。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">       0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f</span><br><span class="line">0000: 49 49 2A 00 08 00 00 00 02 00 1A 01 05 00 01 00</span><br><span class="line">0010: 00 00 26 00 00 00 69 87 04 00 01 00 00 00 11 02</span><br><span class="line">0020: 00 00 40 00 00 00 48 00 00 00 01 00 00 00</span><br></pre></td></tr></table></figure>

<p>上面的是TIFF数据的开头部分, 对它的解读如下;</p>
<ul>
<li>前两个字节是 “I I”, 所以字节序是 ‘Intel’.</li>
<li>在地址0x0004~0x0007处存放的值是 0x08000000, 因此IFD0 从地址 ‘0x0008’开始</li>
<li>在地址0x0008~0x0009处存放的值是 0x0200, 则表示IFD0有 ‘2’ 个目录项.</li>
<li>在地址0x000a~0x000b处存放的值是 0x1A01, 它意味着这是一个 XResolution(0x011A) 标签, 表示这是图像的水平分辨率.</li>
<li>地址0x000c~0x000d处存放的值为 0x0500, 说明数据的格式是一个 unsigned rational(0x0005).</li>
<li>地址0x000e~0x0011处存放的值是 0x01000000, 说明组件的数据只有 ‘1’个. Unsigned rational的数据大小是8字节(组件的大小), 因此数据的总长度是 1x8&#x3D;8字节.</li>
<li>总数居长度比4字节大了, 因此它后面的4个字节里面存放的是一个指向实际数据的偏移量地址.</li>
<li>地址0x0012~0x0015处存放的是 0x26000000, 表示XResolution(水平分辨率) 数据的存储地址是0x0026</li>
<li>地址0x0026~0x0029处存放的数据是 0x48000000, 说明分子的值为 72, 而地址0x002a~0x002d 处存放的是0x0100000000, 说明分母为 ‘1’. 因此XResoultion 的值是 72&#x2F;1.</li>
<li>地址0x0016~0x0017处存放的数据为0x6987, 表示下一个标签是 ExifOffset(0x8769). 这就是 指向 Exif子IFD的偏移量</li>
<li>而它的数据格式是 0x0004, 即是一个无符号的长整形(unsigned long integer).</li>
<li>这个标签只有一个组件. 无符号长整形的数据大小是4字节, 因此总数据长度为4字节.</li>
<li>总数据长度是 4字节, 则说明下一个4字节的数据中存放的是Exif子IFD的偏移量.</li>
<li>地址0x001e~0x0021处存放的是 0x11020000, 则说明Exif子IFD的开始地址是 ‘0x0211’.</li>
<li>这是最后一个目录项, 接下来的4个字节存放的是下一个IFD的偏移地址.</li>
<li>地址0x0022~0x0025处存放的是 0x40000000, 就可以知道下一个IFD的开始地址为 ‘0x0040’</li>
</ul>
<h3 id="2-6-Thumbnail-image"><a href="#2-6-Thumbnail-image" class="headerlink" title="2.6 Thumbnail image"></a><font size=3>2.6 Thumbnail image</font></h3><p>Exif格式中包含缩略图像(除了Ricoh RDC-300Z)。通常它被放到IFD1的后面。</p>
<p>缩略图有 3 种格式：JPEG 格式(JPEG 使用YCbCr)，RGB TIFF 格式， YCbCr TIFF 格式。 其中JPEG形式和RGB的TIFF格式可以直接查看，而YCbCr的TIFF格式需要进行颜色空间的转换后才能正常查看。</p>
<p>在Exif2.1之后推荐使用JPEG 格式和160x120像素的尺寸。 根据 DCF 规格, 缩略图像必须 使用JPEG 格式以及图像的尺寸 固定为160x120 像素。</p>
<p>缩略图的信息存储在 APP Data标记段的最后部分，缩略图的存储格式、起始地址和缩略图长度是由<code>IFD1</code>部分中Directory Entry的值来决定。</p>
<p>缩略图的存储格式由<code>IFD1</code>中的Tag number为<code>0x0103</code>(含义为Compression) 的Directory Entry的值来决定。</p>
<h4 id="2-6-1-JPEG格式的缩略图"><a href="#2-6-1-JPEG格式的缩略图" class="headerlink" title="2.6.1 JPEG格式的缩略图"></a><font size=3>2.6.1 JPEG格式的缩略图</font></h4><ul>
<li>Compression &#x3D; 6时表示缩略图是以JPEG格式存储。几乎所有的 Exif图像中缩略图都使用JPEG 格式。</li>
</ul>
<p>（1）起始的偏移地址由<code>IFD1</code>段的Tag number为<code>0x0201</code>(JpegIFOffset)的决定；</p>
<p>（2）缩略图的长度由<code>IFD1</code>中的Tag number为<code>0x0202</code>(JpegIFByteCount)来决定。</p>
<p>在这种情况下, 我们能从IFD1的JpegIFOffset(0x0201) 标签中得到缩略图的偏移量, 从标签JpegIFByteCount(0x0202)中得到缩略图的大小。数据格式则是普通的 JPEG 格式， 也就是从0xFFD8处开始在0xFFD9处结束。</p>
<h4 id="2-6-2-TIFF格式缩略图"><a href="#2-6-2-TIFF格式缩略图" class="headerlink" title="2.6.2 TIFF格式缩略图"></a><font size=3>2.6.2 TIFF格式缩略图</font></h4><ul>
<li>Compression &#x3D; 1时表示缩略图是以为TIFF格式存储的，这种缩略图的格式是没有经过压缩的。这里涉及到的Entry有三个Tag number分别是：</li>
</ul>
<p>（1）<code>0x0111</code>(StripOffset) 表示缩略图偏移位置；</p>
<p>（2）<code>0x0117</code>(StripByteCounts) 表示缩略图长度;</p>
<p>（3）<code>0x0106</code>(PhotometricInterpretation)，值为1时是RGB形式的TIFF格式存储;值为6时，是YCbCr形式的TIFF格式存储。</p>
<p>缩略图数据的开始点是标签 StripOffset(0x0111) , 缩略图的尺寸就是标签 StripByteCounts(0x0117) 之和。</p>
<p>如果缩略图使用非压缩格式并且IFD1中的标签 PhotometricInterpretation(0x0106) 是 ‘2’, 则缩略图使用了 RGB 格式。 在这种情况下, 我们只要简单的把数据拷贝到计算机的RGB格式文件中就能看到缩略图了(如 BMP 格式, 或者拷贝到 VRAM 目录下)。 Kodak DC-210&#x2F;220&#x2F;260 就使用 这个格式。注意TIFF中存储的像素数据是’RGB’ 顺序的, 而 BMP 里的存储顺序则是 ‘BGR’ 。</p>
<p>如果这个标签的值是 ‘6’, 缩略图使用 YCbCr 格式. 如果想要看到缩略图的话， 必须把它 转换成 RGB 格式的。Ricoh RDC4200&#x2F;4300, Fuji DS-7&#x2F;300 和 DX-5&#x2F;7&#x2F;9 使用的是这种格式 (较新的 RDC5000&#x2F;MX-X00 系列使用的是 JPEG)。</p>
<h2 id="3-一个小工具"><a href="#3-一个小工具" class="headerlink" title="3. 一个小工具"></a><font size=3>3. 一个小工具</font></h2><p>前面我们知道可以用JPEGsnoop工具来分析JPEG图片信息，Exif这种格式的当然也不例外，我在学习的时候自己写代码解析了部分的Exif信息，源码在这里：<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/imx6ull-app-demo/blob/master/LV18_LCD_DEVICE/04_jpeg_exif_analyze/jpeg_analyze.c">LV18_LCD_DEVICE&#x2F;04_jpeg_exif_analyze&#x2F;jpeg_analyze.c · 苏木&#x2F;imx6ull-app-demo - 码云 - 开源中国 (gitee.com)</a>。里面有Makefile文件，直接使用make命令编译即可，这个是使用gcc直接编译，在ubuntu中跑。找一张Exif格式的图片，可以有如下打印信息：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br></pre></td><td class="code"><pre><span class="line">sumu@sumu-virtual-machine:~/1sharedfiles/linux_develop/imx6ull-app-demo/LV18_LCD_DEVICE/04_jpeg_exif_analyze$ ./app_demo 20240929195259MEDIA_CH0_ID001_EXIF.jpg </span><br><span class="line">jpegFileName=20240929195259MEDIA_CH0_ID001_EXIF.jpg, open success, size is 907342, pJpegAddr=0x7fe308f36010!sizeof(uint8_t)=1 sizeof(uint16_t)=2 sizeof(uint32_t)=4</span><br><span class="line">==================== APP1 ====================</span><br><span class="line">段标识:ff e1</span><br><span class="line">段长度:14 7c (5244)</span><br><span class="line">标识符:45 78 69 66 00 00</span><br><span class="line">[relative addr]TIFF Head = 0x0000000c,TIFF Head Addr = 0x7fe308f3601c, JPEG start Addr = 0x7fe308f36010,  idx = 0x0000000a(+0x00000002=0x0000000c)</span><br><span class="line">TIFF头:4d 4d 00 2a 00 00 00 08</span><br><span class="line">       4d 4d (MM)       字节序，II为intel字节序，即小端字节序，MM为Motorola字节序，即大端字节序</span><br><span class="line">       00 2a            Tag Mark，Intel字节序，则对应的存储值为 0x2a00，Motorola 的字节序，则存储值为 0x002a</span><br><span class="line">       00 00 00 08 (8)  到IFD0的偏移，从TIFF头起始位置开始计算</span><br><span class="line">[relative addr]IFD0=0x00000014</span><br><span class="line">IFD0  :00 09 (9 个Entry, IFD0 relative addr=0x00000014)</span><br><span class="line">      | TAG  | TYPE  |  LENGTH   |   OFFSET  |</span><br><span class="line">      |01 0f | 00 02 |00 00 00 08|00 00 00 7a|                            Model [0x00000086]</span><br><span class="line">      |01 10 | 00 02 |00 00 00 08|00 00 00 82|                            Model [0x0000008e]</span><br><span class="line">      |01 1a | 00 05 |00 00 00 01|00 00 00 8a|                      XResolution [0x00000096]</span><br><span class="line">      |01 1b | 00 05 |00 00 00 01|00 00 00 92|                      YResolution [0x0000009e]</span><br><span class="line">      |01 28 | 00 03 |00 00 00 01|00 02 00 00|                   ResolutionUnit [2]</span><br><span class="line">      |01 32 | 00 02 |00 00 00 14|00 00 00 9a|                         DateTime [0x000000a6]</span><br><span class="line">      |02 13 | 00 03 |00 00 00 01|00 01 00 00|                 YCbCrPositioning [1]</span><br><span class="line">      |87 69 | 00 04 |00 00 00 01|00 00 00 ae|                       ExifOffset [174]</span><br><span class="line">      |88 25 | 00 04 |00 00 00 01|00 00 02 92|                          GPSInfo [658]</span><br><span class="line">      00 00 02 98 (到下一个IFD的偏移为 664,为0时表示这是最后一个IFD)</span><br><span class="line">[relative addr]IFD1=0x000002a4</span><br><span class="line">IFD1  :00 06 (6 个Entry)</span><br><span class="line">      | TAG  | TYPE  |  LENGTH   |   OFFSET  |</span><br><span class="line">      |01 03 | 00 03 |00 00 00 01|00 06 00 00|                      Compression [6]</span><br><span class="line">      |01 1a | 00 05 |00 00 00 01|00 00 02 e6|                      XResolution [0x000002f2]</span><br><span class="line">      |01 1b | 00 05 |00 00 00 01|00 00 02 ee|                      YResolution [0x000002fa]</span><br><span class="line">      |01 28 | 00 03 |00 00 00 01|00 02 00 00|                   ResolutionUnit [2]</span><br><span class="line">      |02 01 | 00 04 |00 00 00 01|00 00 02 f6|                     JpegIFOffset [758]</span><br><span class="line">      |02 02 | 00 04 |00 00 00 01|00 00 11 7e|                  JpegIFByteCount [4478]</span><br><span class="line">      00 00 00 00 (到下一个IFD的偏移为 0,为0时表示这是最后一个IFD)</span><br><span class="line">[relative addr]thumbnail=0x00000302</span><br><span class="line">缩略图:ff d8 ff db</span><br><span class="line">APP1只解析了重要内容</span><br><span class="line">==============================================</span><br><span class="line">==================== SOF0 ====================</span><br><span class="line">段标识:ff c0</span><br><span class="line">段长度:00 11 (17)</span><br><span class="line">精度  :08</span><br><span class="line">高度  :05 e8 (1512)</span><br><span class="line">宽度  :0a 80 (2688)</span><br><span class="line">组件数:03</span><br><span class="line">组件ID:01 采样系数:22 量化表号:00</span><br><span class="line">组件ID:02 采样系数:11 量化表号:01</span><br><span class="line">组件ID:03 采样系数:11 量化表号:01</span><br><span class="line">SOF0解析完毕，共解析19字节(包含了段标识，段长度为17字节)</span><br><span class="line">==============================================</span><br><span class="line">read end!readIdx=907340</span><br></pre></td></tr></table></figure>

<p>上面解析的图可以去网盘里下载。</p>
<blockquote>
<p>参考资料：</p>
<p><a target="_blank" rel="noopener" href="https://cloud.tencent.com/developer/article/1427939">JPEG文件格式解析(一) Exif 与 JFIF-腾讯云开发者社区-腾讯云 (tencent.com)</a></p>
<p><a target="_blank" rel="noopener" href="https://cloud.tencent.com/developer/article/2270873">JPEG&#x2F;Exif&#x2F;TIFF格式解读(2):图片元数据保存及EXIF详解-腾讯云开发者社区-腾讯云 (tencent.com)</a></p>
<p><a target="_blank" rel="noopener" href="https://cloud.tencent.com/developer/article/2270874">JPEG&#x2F;Exif&#x2F;TIFF格式解读(3):TIFF与JPEG里面EXIF信息存储原理解读-腾讯云开发者社区-腾讯云 (tencent.com)</a></p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/shelldon/article/details/54407534">JPEG系列二 JPEG文件中的EXIF（下）_jpeg app1-CSDN博客</a></p>
</blockquote>

    </div>

    
    
    

    <footer class="post-footer">




    <div>
        
            <div style="text-align:center;color: #ccc;font-size:14px;">
            ----------本文结束
            <i class="fas fa-fan fa-spin" style="color: #FF1493; font-size: 1rem"></i>
            感谢您的阅读----------
            </div>
        
    </div>





  
  <div class="my_post_copyright"> 
    <p><span>文章标题:</span><a href="/post/ca37adf1.html">LV01-图像-03-图片格式-03-04-JPEG中的Exif文件格式标准</a></p>
    <p><span>文章作者:</span><a href="/" title="欢迎访问 《苏木》 的学习笔记">苏木</a></p>
    <p><span>发布时间:</span>2024年10月12日 - 22:57</p>
    <p><span>最后更新:</span>2025年06月14日 - 00:25</p>
    <p><span>原始链接:</span><a href="/post/ca37adf1.html" title="LV01-图像-03-图片格式-03-04-JPEG中的Exif文件格式标准">https://sumumm.github.io/post/ca37adf1.html</a></p>
    <p><span>许可协议:</span><i class="fab fa-creative-commons"></i> <a rel="license" href= "https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
  </div>
  


          <div class="post-tags">
              <a href="/tags/ALPHA-LV01-%E5%9B%BE%E5%83%8F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/" rel="tag"><i class="fa fa-tag"></i> (ALPHA)LV01-图像基础知识</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/post/7e7b45a9.html" rel="prev" title="LV02-04-终端配置-01-默认终端长度问题">
                  <i class="fa fa-angle-left"></i> LV02-04-终端配置-01-默认终端长度问题
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/post/bb88664f.html" rel="next" title="LV02-ubuntu-扩充swap交换空间">
                  LV02-ubuntu-扩充swap交换空间 <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 2017 – 
    <span itemprop="copyrightYear">2025</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">苏木</span>
  </div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">3.7m</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">225:26</span>
  </span>
</div>




    <span id="sitetime"></span>
    <script defer language=javascript>
        function siteTime()
        {
            window.setTimeout("siteTime()", 1000);
            var seconds = 1000;
            var minutes = seconds * 60;
            var hours = minutes * 60;
            var days = hours * 24;
            var years = days * 365;
            var today = new Date();
            var todayYear = today.getFullYear();
            var todayMonth = today.getMonth()+1;
            var todayDate = today.getDate();
            var todayHour = today.getHours();
            var todayMinute = today.getMinutes();
            var todaySecond = today.getSeconds();
            /*==================================================
            Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
            year        - 作为date对象的年份，为4位年份值
            month       - 0-11之间的整数，做为date对象的月份
            day         - 1-31之间的整数，做为date对象的天数
            hours       - 0(午夜24点)-23之间的整数，做为date对象的小时数
            minutes     - 0-59之间的整数，做为date对象的分钟数
            seconds     - 0-59之间的整数，做为date对象的秒数
            microseconds - 0-999之间的整数，做为date对象的毫秒数
            ==================================================*/
            var t1 = Date.UTC(2017, 
                              5, 
                              19, 
                              0, 
                              0, 
                              0); //北京时间
            var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
            var diff = t2-t1;
            var diffYears = Math.floor(diff/years);
            var diffDays = Math.floor((diff/days)-diffYears*365);
            var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
            var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
            var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
            document.getElementById("sitetime").innerHTML="已在这里 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒";
        }
        siteTime();
    </script>



    </div>
  </footer>

  
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.umd.js" integrity="sha256-ytMJGN3toR+a84u7g7NuHm91VIR06Q41kMWDr2pq7Zo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lozad.js/1.16.0/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>




  <script src="/js/third-party/fancybox.js"></script>

  <script src="/js/third-party/pace.js"></script>


  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


 
        <div id="click-show-text"
            data-mobile = false
            data-text = 富强,民主,文明,和谐,自由,平等,公正,法制,爱国,敬业,诚信,友善
            data-fontsize = 15px
            data-random= false>
        </div>
       

      
        <script async src=https://cdn.jsdelivr.net/npm/hexo-next-mouse-effect@latest/click/showText.js></script>
      

      
    




    <script async src="/js/fancybox_param.js"></script>





<!-- APlayer本体 -->



</body>
</html>
